package com.example.demo.utils;

import java.util.Random;

/**
 * 随机工具类
 * Created by Hy on 2018/8/21.
 */
public class RandomUtils {
    private static final String ALLCHAR="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final String LETTERCHAR="abcdefghijkllmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final String NUMBERCHAR="0123456789";

    /**
     * 根据时间生成随机数15位
     */
    public static String time() {
        long millis = System.currentTimeMillis();
        Random random = new Random();
        //在方法调用返回介于0(含)和n(不含)伪随机，均匀分布的int值
        int end2 = random.nextInt(99);
        //millis+end2格式化为至少2位十进制整数
        return millis + String.format("%02d",end2);
    }
}
